<extend name="Public/layout"/>
<block name="head">
<link rel="stylesheet" href="__PUBLIC__css/connect.css">
<style type="text/css">
.footer{
  display: none;
}
</style>
</block>
   <block name="main">
      <div class="container">
        <div class="form">
          <div class="plat">
            <select id="plat" name="platform_num" autofocus required size="1">
              <option class="place" value="" disabled selected hidden >请选择您投资的平台数量</option>
            </select>
          </div>
          <div class="year">
            <select id="year" name="year" autofocus required size="1">
              <option class="place" value="" disabled selected hidden>请选择您投资网贷的年限</option>
            </select>
          </div>
          <div class="number">
            <select id="number" name="pit_num" autofocus required size="1">
              <option class="place" value="" disabled selected hidden>请选择您踩雷的次数</option>
            </select>
          </div>
        </div>
        <div class="short-comment" id="wordCounta">
            <textarea class="comment-textarea" cols="5" name="introduce" type="text" maxlength="30" placeholder="请输入您的个人简介..." ></textarea>
            <span class="wordWrap">
            <var class="wordHave">0</var> /<var class="word"> 30</var>
            </span>
        </div>
       <div class="btn">
        <p>下一步</p>
      </div>
      </div>
</block>
<block name="js">
      <script type="text/javascript">
      for(var i=1 ; i<100 ;i++){
        var opinion = '<option value ="'+i+'">已投资平台'+i+'家</option>';
        $('#plat').append(opinion);
      }
      for(var i=1 ; i<100 ;i++){
        var opinion = '<option value ="'+i+'">已投资网贷'+i+'年</option>';
        $('#year').append(opinion);
      }
      for(var i=0 ; i<100 ;i++){
        var opinion = '<option value ="'+i+'">已踩雷'+i+'次</option>';
        $('#number').append(opinion);
      }
      $('select').click(function() {
        $(this).css('color','#333333')
      });
      $('.btn').click(function(){
        var plat = $('#plat').val();
        var year = $('#year').val();
        var number = $('#number').val();
        var commentS = $('.comment-textarea').val();
        if(!plat){
            layer.open({
              content: '请选择您投资的平台数量！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });
        }else if(!year){
          layer.open({
              content: '请选择您投资网贷的年限！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });
        } else if(!number){
          layer.open({
              content: '请选择您踩雷的次数！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });
        }else if(!commentS){
          layer.open({
              content: '请输入您的个人简介！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });
        }else{
          var platform_num = $('select[name="platform_num"]').val();
          var year = $('select[name="year"]').val();
          var pit_num = $('select[name="pit_num"]').val();
          var introduce = $('textarea[name="introduce"]').val();
          var postdata = {platform_num,year,pit_num,introduce};
          $.post('{:U("Recommend/factions_thunder")}',postdata,function(res) {
            if(res.err==0) {
              location.href = "/Home/Recommend/matial";
            }
          });
        }

      });
      // 个人简介
  $(function(){
        var wordCount = $("#wordCounta"),
            textArea = wordCount.find("textarea"),
            word = wordCount.find(".word");
            wordHave = wordCount.find(".wordHave");
        statInputNum(textArea,word,wordHave);
    });
    function statInputNum(textArea,numItem,num) {
        var max = numItem.text(),
            curLength;
        textArea[0].setAttribute("maxlength", max);
        curLength = textArea.val().length;
        num.text(curLength);
        textArea.on('input propertychange', function () {
            var _value = $(this).val().replace(/\n/gi,"");
            num.text(_value.length);
        });
    }
      </script>
</block>